<!DOCTYPE html>
<html>
<#include "include/header.html"/>
  <body id="index2">
    <div class="page">
      <header>
      <div class="info">
      <#if championUser??>
            <div class="coins">我的活力币：<span id="myEnergyCurrency">${championUser.energy_currency!}</span></div>
            <#else>
            <div class="coins">我的活力币：<span id="myEnergyCurrency">0</span></div>
            </#if>
          </div>  
      </header>
      <!-- 滚动文字 -->
      <div class="wrapc">
          <div class="carousel clearfix">
            <img src="${ctx}/resource/images/index/star.png" class="star">
            <span>小样乳酸盐欧洲杯大狂欢，看球赛猜胜负赢豪礼，更多详情敬请关注@小样君 官方微信</span>
          </div>
          </div>
      <div class="qd">
        <div class="wrap">
          <#if currday_sign = '0' >
                    <img id="qd_btn" src="${ctx!}/resource/images/index/qd_btn.png" onclick="clickSign();" class="qd-btn">
          <#else>
                    <img id="qd_btn" src="${ctx!}/resource/images/index/qd_btn_gray.png" class="qd-btn">
          </#if>
          <div class="text">签到可获<span>100</span>个活力币</div>
        </div>
      </div>
      <div class="act">
        <a href="javascript:void(0);"><button onclick="forwardEuropeGuessing();"></button></a>
      </div>
      <img src="${ctx!}/resource/images/wx/ban.jpg" class="ban" id="ban_id">
      <div class="gambling-entries" >
        <div class="wrap">
          <div class="et1"><a href="javascript:void(0);"><button onclick="forwardTurntable();">兑换</button></a></div>
          <div class="et2"><a href="javascript:void(0);"><button onclick="forwardPocket();">兑换</button></a></div>
        </div>
      </div>
      <img src="${ctx!}/resource/images/wx/btm_bg.png" class="btm">
    </div>
    <!-- 签到成功 -->
      <div class="dialog qd-success">
        <div class="d-body" id="qd-success-sign">
          <p>获得<span>100</span>个活力币</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>

      <!-- 签到失败 -->
      <div class="dialog qd-fail">
        <div class="d-body" id="qd-fail-sign">
        <p class="message">系统繁忙 请稍后再试</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>
      <!-- 欧洲杯弹窗 -->
<div class="dialog champ">
  <div class="d-body">
    <img src="${ctx}/resource/images/index/dialog_close.png" class="close"  onclick="dialogClose()">
  </div>
  <div class="d-footer">
    <img src="${ctx}/resource/images/index/join_btn.png" class="btn one back" onclick="forwardEuropeGuessing()"> <!--点击参与按钮-->
  </div>
</div>
    <div class="mask"></div>
    <script type="text/javascript">
    var is_dialog=getQueryStringRegExp("is_dialog");
    if(is_dialog != "1#ban_id" ){
       dialog(".champ");  
    }
    
    function clickSign(){
       statistics(); //cnzz统计
	$.ajax({type : "POST",url : "${ctx}/home/sign",async : false,data:{},success:function(json){
	       if(json.code == 0 ){
	       $("#qd_btn").attr("src","${ctx!}/resource/images/index/qd_btn_gray.png");
	       $("#qd_btn").removeAttr("onclick");
	       $("#myEnergyCurrency").html(json.energy_currency);
	       dialog(".qd-success");
	       }else{
	       if(json.code == 404 ){
	            window.location.href=json.msg;
	       }else{
	           var msg="<p class='message'>"+json.msg+"</p>";
		       $("#qd-fail-sign").html(msg);
	           dialog(".qd-fail");
	           }
	           }
	       }
	    }); 
	}
	//跳转到红包
	function forwardPocket(){
	statistics(); //cnzz统计
	  window.location.href="${ctx}/home/forwardPocket";
	}
	//跳转到欧洲杯赛事竞猜
	function forwardEuropeGuessing(){
	  statistics(); //cnzz统计
	  window.location.href="${ctx}/home/forwardEuropeGuessing";
	}
	//跳到转盘
	function forwardTurntable(){
	statistics(); //cnzz统计
	  window.location.href="${ctx}/home/forwardTurntable";
	}
    </script>
  </body>
</html>